{%extends file='layout/layout.html' %}
{%block name="content"%}

<div class="page-title ui-widget-content ui-corner-all">
                <h1>管理员选项</h1>
                <div class="other">

                    <ul id="dashboard-buttons">
                        <li>
                            <a href="/admin/activity" class="Book_phones tooltip" title="Book phones">
                                活动报名
                            </a>
                        </li>
                        <li>
                            <a href="/admin/clothing" class="Books tooltip" title="Books">
                                服装兑换
                            </a>

                        </li>
                        <li>
                            <a href="/admin/user" class="Box_recycle tooltip" title="Box recycle">
                                会员积分
                            </a>
                        </li>
                        <li>
                            <a href="/admin/share" class="Books tooltip" title="Books">
                                分享上传
                            </a>

                        </li>

                    </ul>
                    <div class="clearfix"></div>
                </div>


            </div>
<div class="page-title ui-widget-content ui-corner-all">
    <h1>配置详情</h1>
    <div class="other">
        <label>中奖概率:</label>
        <input type="text"  name="winning" value="{%$winning|default:0%}">%
        <div class="clearfix"></div>
    </div>
    <div class="other">
        <label>签到积分:</label>
        <input type="text"  name="min" value="{%$min|default:0%}">
        ~
        <input type="text"  name="max" value="{%$max|default:0%}">
        <div class="clearfix"></div>
    </div>
    <div class="other">
        <input type="button" value="设置" onclick="setting()"/>
        <div class="clearfix"></div>
    </div>
</div>

{%/block%}
{%block name="js" append%}
<script type="text/javascript">

    function setting() {
        var winning = $("input[name='winning']").val();
        var min = $("input[name='min']").val();
        var max = $("input[name='max']").val();

        if (!isDigits(winning)) {
            showmsg('中奖概率格式错误', 2);
            return false;
        }
        if (!isDigits(min)&&!isDigits(max)) {
            showmsg('签到积分格式错误', 2);
            return false;
        }
        $.post('/api/setting.json',{winning:winning,min:min,max:max},function (data, textStatus, jqXHR) {
            if(jqXHR.status==200){
                showmsg(jqXHR.responseText, 1);
                dorefulsh();

            }else{
                showmsg(jqXHR.responseText, 2);
            }
        });
    }

</script>
{%/block%}



